const http = uni.$u.http

//首页
export const getHome = (data) => http.get('api/v1/pages/home', data);
 
//code登录
export const login = (data, config = {}) => http.post('api/v1/miniapp/auth/token', data, config)
//首次登陆
export const firstlogin = (data, config = {}) => http.post('api/v1/miniapp/auth/register', data, config)
//获取协议
export const getAgreement = (data) => http.get('api/index/getAgreement', data)

//获取商户分类
export const getTownCategoies = (data) => http.get('api/town/categories', data)
//获取商户列表
export const getMerchants = (data) => http.get('api/town/merchants', data)
//获取商户详情
export const getMerchantsDetail = (id,data) => http.get(`api/town/merchants/${id}`, data)

//新建调解
export const addCases = (data, config = {}) => http.post('api/cases', data, config)
//获取调解申请参数
export const getCasesParameters = (data) => http.get('api/cases/parameters', data)

// 服务列表
export const getServiceLogList = (data) => http.get('api/town/service-logs', data)
// 服务详情
export const getServiceLogDetail = (id,data) => http.get(`api/town/service-logs/${id}`, data)


//获取乡村快讯列表
export const getNews = (data) => http.get('api/town/news', data)
//获取乡村快讯详情
export const getNewsDetail = (id,data) => http.get(`api/town/news/${id}`, data)


//获取乡村振兴
export const getTown = (id,data) => http.get('api/town', data)

//获取我的任务列表
export const getMeTask = (data) => http.get('api/me/task-assignments', data)
//获取任务详情
export const getTaskDetail = (id,data) => http.get(`api/task-assignments/${id}`, data)


//添加任务进度
export const addTaskProgress  = (data, config = {}) => http.post('api/task-assignments/1/progressRecords', data, config)
//新建我的任务
export const addTask  = (data, config = {}) => http.post('api/tasks', data, config)
//我的相关参数
export const getMeParameters = (data) => http.get('api/me/parameters', data)


//首次登陆
export const updateProfile = (data) => http.request({
	method: 'PATCH',
	url:'api/me/profile',
	data: data
})

//驿旅时光
export const getShiguang = (data) => http.get('api/v1/pages/shiguang', data)

//获取村治
export const getGovernance = (id = 0,data) => http.get('api/town/governance' + (id > 0 ? `/${id}` : ''), data)

//获取村治子孙列表
export const getGovernanceList = (id,data) => http.get(`api/town/governance/${id}/sub`, data)


export const uploadFile = (data) => http.upload('api/document', data)

//获取文化详情
export const getCultureDetail = (code,data) => http.get(`api/v1/pages/culture/${code}`, data)
//获取美食详情
export const getFoodsDetail = (code,data) => http.get(`api/v1/pages/foods/${code}`, data)
//获取景区详情
export const getSpotsDetail = (code,data) => http.get(`api/v1/pages/scenicSpots/${code}`, data)

//获取历史文化详情
export const getHistoryDetail = (code,data) => http.get(`api/v1/pages/history/${code}`, data)

//获取评理堂
export const getDispute = (data) => http.get('api/v1/pages/dispute', data)
//提交评理堂
export const postDispute = (data,config = {}) => http.post('api/v1/pages/dispute', data,config)

//基层治理数字化平台
export const getPageGovernance = (data) => http.get('api/v1/pages/governance', data)

//治理级别详情
export const getGovernanceDetail = (code,data) => http.get(`api/v1/pages/governance/${code}`, data)
//镇川好物
export const getPageTreasures = (data) => http.get('api/v1/pages/treasures', data)


//便民页面
export const getPageServices = (data) => http.get('api/v1/pages/services', data)



//获取我的提交列表
export const getMeCases = (data) => http.get('api/cases', data)
//获取提交详情
export const getCasesDetail = (id,data) => http.get(`api/cases/${id}`, data)